<div class="sub-main-container">
    <div class="search-wrap">
        <form nz-form [nzLayout]="'inline'" [formGroup]="searchForm">
            <nz-form-item>
                <nz-form-label>时间范围</nz-form-label>
                <nz-form-control>
                    <nz-range-picker formControlName="rangePickerTime" nzShowTime
                                     [nzPlaceHolder]="['起始日期', '截止日期']"></nz-range-picker>
                </nz-form-control>
            </nz-form-item>
            <nz-form-item>
                <nz-form-label>关键字</nz-form-label>
                <nz-form-control>
                    <input formControlName="keywords" nz-input placeholder="关键字"/>
                </nz-form-control>
            </nz-form-item>
            <nz-form-item>
                <nz-form-control>
                    <button nz-button nzType="primary" (click)="queryInfo(true)"><i nz-icon nzType="search"></i>查询
                    </button>
                </nz-form-control>
            </nz-form-item>
        </form>
        <button nz-button nzType="danger" class="add-btn" (click)="openEditModal()">
            <i nz-icon nzType="plus" nzTheme="outline"></i>新增
        </button>
    </div>

    <div class="main-wrap">
        <nz-table #dataTable
                  class="main-table"
                  [nzData]="tableData"
                  [nzTotal]="total"
                  [nzFrontPagination]="false"
                  [(nzPageIndex)]="pageNum"
                  [(nzPageSize)]="pageSize"
                  [nzLoading]="loading"
                  (nzPageIndexChange)="queryInfo()"
                  nzBordered
                  nzSize="middle">
            <thead>
            <tr>
                <th>编号</th>
                <th>主题</th>
                <th>培训人</th>
                <th>培训对象</th>
                <th>培训时间</th>
                <th>培训课时</th>
                <th>培训小结</th>
                <!--<th>附件</th>-->
                <th>备注</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            <tr *ngFor="let data of dataTable.data">
                <td>{{data.code}}</td>
                <td>{{data.name}}</td>
                <td>{{data.trainUser}}</td>
                <td>{{data.user}}</td>
                <td>{{data.trainTime}}</td>
                <td>{{data.trainHour}}</td>
                <!--<td>{{data.summary}}</td>-->
                <td>{{ data.summary }}</td>
                <td>{{data.remark}}</td>
                <td>
                    <a (click)="openEditModal(false, data)">详情</a>
                    <nz-divider nzType="vertical"></nz-divider>
                    <a (click)="openEditModal(true, data)">编辑</a>
                    <nz-divider nzType="vertical"></nz-divider>
                    <a nz-popconfirm nzPopconfirmTitle="确认删除？" nzPopconfirmPlacement="left"
                       (nzOnConfirm)="onDelete(data.id)">
                        删除
                    </a>
                </td>
            </tr>
            </tbody>
        </nz-table>
    </div>

    <nz-modal nzClassName="custom-modal sf-education-modal" nzWidth="760" [nzFooter]="queryType"  [(nzVisible)]="modalShow"
              [nzTitle]="modalTitle"
              (nzOnCancel)="onCancel()" (nzOnOk)="onConfirm()">
        <form nz-form [formGroup]="form">
            <div nz-row [nzGutter]="24">
                <div nz-col [nzSpan]="12">
                    <nz-form-item nzFlex>
                        <nz-form-label [nzSpan]="6">编号</nz-form-label>
                        <nz-form-control [nzSpan]="16">
                            <input nz-input formControlName="code" placeholder="编号">
                        </nz-form-control>
                    </nz-form-item>
                </div>
                <div nz-col [nzSpan]="12">
                    <nz-form-item nzFlex>
                        <nz-form-label [nzSpan]="6">主题</nz-form-label>
                        <nz-form-control [nzSpan]="16">
                            <input nz-input formControlName="name" placeholder="主题">
                        </nz-form-control>
                    </nz-form-item>
                </div>
                <div nz-col [nzSpan]="12">
                    <nz-form-item nzFlex>
                        <nz-form-label [nzSpan]="6">培训人</nz-form-label>
                        <nz-form-control [nzSpan]="16">
                            <input nz-input formControlName="trainUser" placeholder="培训人">
                        </nz-form-control>
                    </nz-form-item>
                </div>
                <div nz-col [nzSpan]="12">
                    <nz-form-item nzFlex>
                        <nz-form-label [nzSpan]="6">培训对象</nz-form-label>
                        <nz-form-control [nzSpan]="16">
                            <input nz-input formControlName="user" placeholder="培训对象">
                        </nz-form-control>
                    </nz-form-item>
                </div>
                <div nz-col [nzSpan]="12">
                    <nz-form-item nzFlex>
                        <nz-form-label [nzSpan]="6">培训时间</nz-form-label>
                        <nz-form-control [nzSpan]="16">
                            <nz-date-picker formControlName="trainTime"
                                            nzShowTime
                                            nzFormat="yyyy-MM-dd HH:mm:ss"
                                            nzPlaceHolder="培训时间"></nz-date-picker>
                        </nz-form-control>
                    </nz-form-item>
                </div>
                <div nz-col [nzSpan]="12">
                    <nz-form-item nzFlex>
                        <nz-form-label [nzSpan]="6">培训课时</nz-form-label>
                        <nz-form-control [nzSpan]="16">
                            <input nz-input formControlName="trainHour" placeholder="培训课时">
                        </nz-form-control>
                    </nz-form-item>
                </div>
                <div nz-col [nzSpan]="24">
                    <nz-form-item nzFlex>
                        <nz-form-label [nzSpan]="3">培训小结</nz-form-label>
                        <nz-form-control [nzSpan]="20">
                            <textarea formControlName="summary" nz-input rows="2"></textarea>
                        </nz-form-control>
                    </nz-form-item>
                </div>
                <div nz-col [nzSpan]="24">
                    <nz-form-item nzFlex>
                        <nz-form-label [nzSpan]="3">备注</nz-form-label>
                        <nz-form-control [nzSpan]="20">
                            <textarea formControlName="remark" nz-input rows="2"></textarea>
                        </nz-form-control>
                    </nz-form-item>
                </div>
                <div nz-col [nzSpan]="22" [nzOffset]="1" style="padding-bottom: 20px;">
                    <nz-upload
                            nzType="drag"
                            [nzMultiple]="true"
                            [(nzFileList)]="fileList"
                            [nzDisabled]="fileUploadDisabled"
                            (nzChange)="handleChange($event)"
                            [nzAction]="uploadUrl"
                    >
                        <p class="ant-upload-drag-icon">
                            <i nz-icon nzType="inbox"></i>
                        </p>
                        <p class="ant-upload-text">点击或者拖拽文件到此处上传</p>
                    </nz-upload>
                </div>
            </div>
        </form>
    </nz-modal>

</div>
